Skip to content

Conversation

@NeejWeej
Copy link
Collaborator

@NeejWeej NeejWeej commented Oct 1, 2025

Utilize the polymorphic_serialization flag introduced in this PR:

pydantic/pydantic#12518

@NeejWeej NeejWeej force-pushed the nk/serialize_as_any_updates branch from 781d7a1 to 31bdbb6 Compare October 31, 2025 20:02
@NeejWeej NeejWeej changed the base branch from pit/serialize_as_any to main October 31, 2025 20:06
pyproject.toml Outdated
"pandas",
"pyarrow",
"pydantic>=2.6,<3",
"pydantic>=2.35,<3",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong version specifier still

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yup, I think that was the pydantic-core version where this came from.

@NeejWeej NeejWeej force-pushed the nk/serialize_as_any_updates branch from 31bdbb6 to 5367fd3 Compare October 31, 2025 20:27
@NeejWeej
Copy link
Collaborator Author

I think this is blocked by this: pydantic/pydantic#12382

Ex a build error. that occured:

E pydantic_core._pydantic_core.PydanticSerializationError: Unable to serialize unknown type: <class 'ccflow.tests.test_base_serialize.MyEnum'>

Even though MyEnum has a pydantic core schema defined (it's a ccflow enum)

Notably, the above issue states:
image

That first recommendation is what we currently do with the MetaClass, and apply the SerializeAsAny annotation to pydantic BaseModels here: https://github.com/Point72/ccflow/blob/main/ccflow/base.py#L117

image

It seems we can't move off of that until these issues are addressed

@NeejWeej NeejWeej changed the title Fix tests for serialize_as_any [WIP] Utilize serialize_as_any instead of Metaclass to adjust annotations Nov 2, 2025
@NeejWeej NeejWeej added the type: feature Feature requests label Nov 2, 2025
@NeejWeej NeejWeej force-pushed the nk/serialize_as_any_updates branch from ff8c9e3 to 1ac3bd8 Compare November 21, 2025 18:48
@NeejWeej NeejWeej changed the title [WIP] Utilize serialize_as_any instead of Metaclass to adjust annotations Utilize serialize_as_any instead of Metaclass to adjust annotations Nov 21, 2025
@NeejWeej NeejWeej changed the title Utilize serialize_as_any instead of Metaclass to adjust annotations Utilize polymorphic_serialization instead of Metaclass to adjust annotations Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature Feature requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants